    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            body{
                height: 5000px;
            }
        </style>
    </head>
    <body>
    <script>
        window.onscroll=function () {
            console.log(document.body.scrollTop);
        }
        // console.log(document.body.scrollHeight);
    </script>
    </body>
    </html>